'''
Created on 30/10/2011

@author: Mateo
'''

class MMU(object):
    '''
    classdocs
    '''


    def __init__(self, allocationMethod, memory):
        
        '''
        Constructor
        '''
        self.allocation = allocationMethod
        self.memory=memory
        
        
        
        
    def setOS(self, os):
        
        self.os = os
        
    def load(self, pid, program):########
        
        self.allocation.allocate(pid, program, self ,self.memory)################
        
    def read(self, pid, instrNumber):##########################
        
        return self.allocation.read(pid, instrNumber ,self.memory)###############


    def unload(self, pid):################
    
        self.allocation.unload(pid,self.memory)   ############## 
        
        
    def allocateRegister(self, value):
        
        return self.allocation.allocateRegister(value)
    
    def readRegister(self, dire):
        
        return self.memory.read(dire)
        
                
        
        
        
    def thereIsNoSpaceInMemory(self, pid):
        
        self.os.thereIsNoSpaceInMemory(pid)
        
        
        
        
   

    
                
            